-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example: Plot drug binding hotspots w/ NGLView #62
base: master
Are you sure you want to change the base?
Conversation
This is not true anymore. :D You can use the latest version, and either use
So that you can view a snapshot of the live notebook in nbviewer: https://nbviewer.jupyter.org/github/arose/nglview/blob/master/notebooks/gui.ipynb Related issues: |
Cool! Thanks, and I'll try that out! (I'll also have to check through some of the OpenPathSampling examples, which I think will also benefit from that.) |
Should be available in v2.6.7: nglviewer/nglview#839 cheers. |
Added a few new functions; need to clean up and write tests
I have additional comments while playing with your notebook:
|
@hainm : Could you glance over the text in the notebook section "Creating the NGLView color mapping"? I just want to be sure that I'm accurately describing things. (And thanks for the other suggestions -- in particular, I hadn't been aware of @sroet : This is ready for review. I think I prefer to leave this as "make the user do the conversion", because (1) it's about 7 lines of code; (2) it is only relevant if you're looking at contacts with just 1 residue (this would not work for visualizing protein-protein interfaces); and (3) it goes to the narrative I'm always pushing about a scientific software ecosystem, where it is easy to get the pieces to talk to each other. A quick summary of what's in this PR:
Still desired: a way to get nbsphinx to include some NGLView output when it generates PDF output. It might be possible by editing notebook metadata -- I haven't tried that yet. Note: when merging this one, please squash commits. Every notebook save took a lot of space. |
Looks good to me. Per "where color_* are colors that can be names ('red', 'blue') or can be web-formatted hexadecimal values ('#FF0000', '#0000FF'),", the color can be a predefined scheme too (e.g: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small doc change requested.
Also, you might want to reference the command jupyter-nbextension enable nglview --py --sys-prefix
at the end of the notebook as a trouble shooting tip (as it took me a bit of effort finding that command after my conda install)
LGTM otherwise
interpreted as ``Normalize(0, 1)``, meaning that the data is already | ||
mapped to the correct values. A tuple should be a 2-tuple of (vmin, | ||
vmax). | ||
bytes : bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add slightly more documentation to this keyword (as it was relatively difficult to find in the matplotlib documentation as well)
@hainm: This embedding works almost perfectly for me. The one thing that I've noticed is that the orientation of the camera is not saved in the HTML embeddings. Is that possible to fix? |
hi @jbloom, it might be fixed according to this issue but I have not tried to fix that in nglview yet. For the time being, you might want to update the orientation in html file. cheers. |
Consider drug binding. I thought it might be interesting to visualize the per-residue contact frequency on the protein itself, using NGLView.
Per-residue coloring had been hidden API in NGLView, and had changed since the last time I used it. So after finding the fix (nglviewer/nglview#491 (comment)), I asked @hainm if it could join the public API and he said that he'd make it a priority! (Thanks!)
This PR will be updated once the official NGLView API is in place. I mainly want it up so that @hainm can see my use case. I may add other functions to the main code to facilitate this, as well, or we might leave it as an advanced example (I've heavily commented the fancier bits of code that would perhaps be moved to a function).
With the GSK3B trajectory that we already have in the repo, the results are kind of dull (and maybe viridis isn't the best color map):
Maybe I should ask for one of those DE Shaw trajectories -- not to put in the repo, but it might make a nice example for the paper!